<?php
if (!defined("MCTDESIGN")) die("#");
function show_category_product($data,$catid="",$catparentid="") {
	global $mysql, $tb_fix, $dir_tpl, $shop_usd,$temp;
	$temp_pro = $temp;
    // url
    if($data['cat_code'] == ""){
        $data['cat_code'] = convertText($data['cat_title']);
    }
    if($data['pro_code'] == ""){
        $data['pro_code'] = convertText($data['pro_name']);
    }
    // content desc
    $data['pro_content_desc'] = subCutString($data['pro_content_desc'],15);
    //hinh
	$data['pro_images'] = "viewImage.php?image=".$data['pro_images']."&width=125&height=100";
    // gia
		if ($data["pro_promotion_vnd"]!=0) {
			$price = $data["pro_promotion_vnd"];
			$price = number_format($price, 0, '.', '.');
			$html_price = "<font style=\"color:red; font-size: 12px; font-weight:bold;\">".$price." VNĐ</font>";
		}
		else {
			$price = $data["pro_price"]*$shop_usd;
			$price = number_format($price, 0, '.', '.');
			$html_price = "<font style=\"color:red; font-size: 12px; font-weight:bold;\">".$price." VNĐ</font>";
			if ($data["pro_promotion_usd"]!=0) {
				$price_promotion = $data["pro_promotion_usd"]*$shop_usd;
				$price_promotion = number_format($price_promotion, 0, '.', '.');
				$html_price = "<font style=\"color:#666666; font-size: 11px; text-decoration: line-through;\">".$price." VNĐ</font><br><font style=\"color:red; font-size: 12px; font-weight:bold;\">".$price_promotion." VNĐ</font>";;
			}
		}
    $data['pro_price'] = $html_price;    
    $temp_pro->assign( 'base_tpl', "".$dir_tpl."" );
    $temp_pro->assign('data',$data);
	if ($data['pro_focus'] == 1) $temp_pro->assign( 'new_images', "<img src=\"New.gif\">" );
	$html_product = $temp_pro->fetch( 'product/_list_product.mct' );
	return $html_product;
}
function check_copyright(){
    global $tb_fix, $anyDB,$db_name;
    $table = $tb_fix."_copyright";
    $err = "";
    $sql = "show tables like '$table'";
    $q = $anyDB->query($sql);
    $t = $anyDB->numRows($q);
    if($t > 0){
        $sql = "select * from ".$table."";
        $q = $anyDB->query($sql);
        $total = $anyDB->numRows($q);
        if($total > 0){
            $r = $anyDB->getNext($q);    
            if($r['code'] != "McT" || $r['title'] != "McT Design | Web Designer" || $r['link'] != "http://www.mctdesign.net" || $r['images'] != "_images/copyright/mct-design.png"){
                $err = "<a href='http://www.mctdesign.net'><h2 style='color: red;text-align: center'>Bạn không được thay đổi thông tin bản quyền của McT Design</h2></a>";   
            }
        }else{
            $err = "<a href='http://www.mctdesign.net'><h2 style='color: red;text-align: center'>Bạn không được xóa thông tin bản quyền của McT Design</h2></a>";
        }
    }else{       
       $err = "<a href='http://www.mctdesign.net'><h2 style='color: red;text-align: center'>Database không chứa bảng của McT Design</h2></a>"; 
    }
    if($err) echo $err;    
}
//check_copyright();
function _getModules($module) {    
	global $dir_tpl, $mysql, $tb_fix, $act, $_SESSION,$temp,$web_title,$mctsitelang;
	//_header();   
        
	if ($module == 'home') {
		include("./_modules/_home.php");
	}
	else {
		switch($module){
			case "product":
				$title = "Sản phẩm ";
				include("./_modules/_product.php");
				break;	
            case "gioithieu":
                $title = "Giới Thiệu ";
                include("./_modules/_gioithieu.php");
				break;	    		
            case "getConfig":
				$title = "Thông tin ";
				include("./_modules/_getConfig.php");
				break; 
            case "tours":
				$title = "Tours ";
				include("./_modules/_tours.php");
				break;        
			case "news":
				$title = "Tin tức ";
				include("./_modules/_news.php");
				break;              
			case "contact":
				$title = "Liên hệ ";
				include("./_modules/_contact.php");
				break; 			
			case "lichkhoihanh":
				$title = "Lịch khởi hành";
				include("./_modules/_lichkhoihanh.php");
				break;   
			case "search":
				$title = "Tìm kiếm";
				include("./_modules/_timkiem.php");
				break;                                                                                      
			default : 
				$content = msg_Error("<br><br><br>KHÔNG TÌM THẤY trANG NÀY");
				break;
		}
		$temp->assign( 'content', "".$content."" ); // noi dung toan bo site gioithieu
        $temp->assign( 'title', "$title | $web_title" ); 
		$temp->assign( 'base_tpl', "".$dir_tpl."" );
        $temp->assign( 'lang', "".$mctsitelang."" );
		$html_browse = $temp->display( '_main.mct' );
	}
	//_footer();
}

?>